package net.sashag.nadlandroid;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;

public class DebugBuildHelper {

	private static boolean wasSet;
	private static boolean isDebugBuild;
	
	public static boolean isRunningDebugBuild(Context context) {
		if (wasSet) {
			return isDebugBuild;
		}
		try {
			ApplicationInfo info = context.getPackageManager().getApplicationInfo("net.sashag.nadlandroid", 0);
			isDebugBuild = 0 != (info.flags & ApplicationInfo.FLAG_DEBUGGABLE);
		} catch (NameNotFoundException e) {
			isDebugBuild = BuildConfig.DEBUG;
		}
		return isDebugBuild;
	}
	
}
